#328 2182 2727 5490 5499
a = 2*27**7+3**10-9
s = 0
while a>0:
    if a%3==0:
        s+=1
    a//=3
print(s)